﻿using System.ComponentModel;
using System.Runtime.InteropServices;
using System.Web.UI;
using System.Web.UI.WebControls.WebParts;

namespace Practical.SharePoint.Base.WebParts
{
    [Guid("817dbc95-59bf-4554-a2cc-fb4a72043611")]
    [ToolboxItemAttribute(false)]
    public class ADUserOrGroupInfoWebPart : WebPart
    {
        // Visual Studio might automatically update this path when you change the Visual Web Part project item.
        private const string ASCX_PATH = @"~/_CONTROLTEMPLATES/Practical.SharePoint.Base/ADUserOrGroupInfoWebPartUserControl.ascx";

        protected override void CreateChildControls()
        {
            Control control = Page.LoadControl(ASCX_PATH) as ADUserOrGroupInfoWebPartUserControl;
            if (control != null)
            {
                ADUserOrGroupInfoWebPartUserControl adUserOrGroupInfoWebPart =
                    (ADUserOrGroupInfoWebPartUserControl) control;
                adUserOrGroupInfoWebPart.InputLabelText = this.InputLabelText;
                Controls.Add(control);
            }
        }

        #region Web Part Properties

        [WebDisplayName("Label for Input Box")]
        [Category("Settings")]
        [Personalizable(PersonalizationScope.Shared)]
        [WebBrowsable(true)]
        public string InputLabelText { get; set; }

        #endregion
    }
}
